package com.comtop.topcloud.device.service.impl;

import com.comtop.topcloud.device.model.mysql.StatisticsTable;
import com.comtop.topcloud.device.mapper.StatisticsTableMapper;
import com.comtop.topcloud.device.service.StatisticsTableService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 * 统计数据表 服务实现类
 * </p>
 *
 * @author 张俊彬
 * @since 2025-01-04
 */
@Service
public class StatisticsTableServiceImpl extends ServiceImpl<StatisticsTableMapper, StatisticsTable> implements StatisticsTableService {

    @Override
    public StatisticsTable getByDeviceIdAndTimeGranularityAndTimeStamp(String deviceId, String value, Date previousTime) {
        return baseMapper.selectByDeviceIdAndTimeGranularityAndTimeStamp(deviceId, value, previousTime);
    }

    @Override
    public StatisticsTable getLastByDeviceIdAndTimeGranularity(String deviceId, String value) {
        return baseMapper.selectLastByDeviceIdAndTimeGranularity(deviceId, value);
    }
}
